<?php


add_action('admin_menu', 'add_page_into_payment');
function add_page_into_payment()
{
	 add_submenu_page('payment-paypal','Ngân Lượng', 'Ngân Lượng', 'administrator','Ngan-luong','add_form_html_admin');
}

function add_form_html_admin()

{
     ?>
   <div class="wrap">
 <div><h2>Cấu Hình Thông Số Ngân Lượng</h2></div>
   <?php
        if(wp_verify_nonce($_POST['action_ngan_luong_config'],'ngan_luong_config'))
        {
        	if(get_option('email_receiver'))
        	{
        		
        		update_option('email_receiver',$_POST['email_receiver']);
        	}
        	else 
        	{
        		add_option('email_receiver',$_POST['email_receiver']);
        	}
        	
        	if(get_option('merchant_site_code'))
        	{
        			update_option('merchant_site_code',$_POST['merchant_site_code']);
        	}
        	else 
        	{
        		add_option('merchant_site_code',$_POST['merchant_site_code']);
        	}
        	
        if(get_option('secure_pass'))
        	{
        			update_option('secure_pass',$_POST['secure_pass']);
        	}
        	else 
        	{
        		add_option('secure_pass',$_POST['secure_pass']);
        	}
        
        if(get_option('status_nl'))
        	{
        			update_option('status_nl',$_POST['status_nl']);
        	}
        	else 
        	{
        		add_option('status_nl',$_POST['status_nl']);
        	}
        	add_option('status_nl',$_POST['status_nl']);
        	echo '<h2>Saved Successful!</h2>';
        }
   
   ?>
<?php  echo get_option('merchant_site_code');
  echo get_option('secure_pass');


?>

<fieldset style="border:1px solid #ddd;">
<legend >Cấu Hình Chung</legend>
 <form action="" method="post">
      <table style="padding:10px;">
         <tr>
         <td>Trạng Thái:</td>
         <td><select name="status_nl">
		  <option value="yes">Chạy</option>
		  <option value="no">Test</option>
            </select> 
            <?php echo get_option('status_nl')?>
            </td>
         </tr>
         <tr>
         <td>Email Nhận Tiền:</td>
         <td><input type="text" style="width:130%;" name="email_receiver" value="<?php echo get_option('email_receiver');?>"/></td>
         </tr>
         <tr>
         <td>Merchant site code:</td>
         <td><input type="text" style="width:130%;" name="merchant_site_code" value="<?php echo get_option('merchant_site_code');?>"/></td>
         </tr>
         <tr>
         <td>Secure pass:</td>
         <td><input type="text" style="width:130%;" name="secure_pass" value="<?php echo get_option('secure_pass');?>"/></td>
         </tr>
         <tr>
		 <td></td>
		 <td><input class="button-primary" type="submit" name="submit" value="Save"/></td>
		 </tr>
		
		</table>    
		 <?php wp_nonce_field('ngan_luong_config','action_ngan_luong_config')?>
		   </form>

</fieldset>


</div>
     <?php 
}